//	--------------------------------------------------------------------
//	Copyright(C) 2006,2007 Zhao Yukun. All rights reserved.
//	This file is a part of the Xeres system.
//	Xeres 2007
//	Contact : xeres.engine@gmail.com
//	$(reservedInfo)
//	$(reservedDeclaration)
//	--------------------------------------------------------------------
///	@file	<XAppPopup.h>
///	@path	~/src/appear/xwin/
///	@date	2008/10/12
///	@desc	.

#pragma once

#include "xeres.h"

#include "gui/image/IBitmap.h"

#include "appear/xwin/XAppFrame.h"

namespace xeres {

	/*! 
		\class	XAppPopup
		\brief
	*/
	class XAppPopup : public XAppFrame
	{
	public:

		/// \ctor
		XAppPopup( void );

		/// \ctor
		XAppPopup( const Rect<int>& placement );

		/// \ctor
		XAppPopup( const Pair<int>& size );

		/// \dtor
		virtual ~XAppPopup( void );

		DECL_IOBJECT_CLASS_DYNAMIC( XAppPopup , XAppFrame );

	public:

		/// \name XGui Component Attributes
		//@{

		/// \brief	Call when focus in.
		virtual void OnFocusIn( Updater& updater , RefWeak<IGuiComp> last );

		/// \brief	Call when focus out.
		virtual void OnFocusOut( Updater& updater , RefWeak<IGuiComp> next );
		
		/// \brief	Draw background.
		virtual void OnDrawBackground( Composition& composition );

		//@}

		/// \name XAppPopup Methods
		//@{

		/// \brief	Set popup background.
		void SetBackground( Ref<IBitmap> bitmap , const Pair<int>& edge );

		/// \brief	Set popup background.
		void SetBackground( Ref<IBitmap> bitmap , const Pair<int>& edge , const Pair<int>& aeroEdge );

		//@}

		/// \brief	Control how to composite the frame.
		virtual void OnComposite( RenderContext& rc , FrameComposition& fc );

	private:

		// @data
		Ref<XAppPopup>	m_subPopup;
		Ref<IBitmap>	m_background;
		Pair<int>		m_edge;
		Pair<int>		m_aeroEdge;
	};
	
} // namespace xeres
